import axios from "axios";

export default {
    state: {
        banners: [],
    },
    mutations: {
       SET_BANNERS(state, data) {
           state.banners = data
       }
    },
    actions: {
        getBannersAction({commit}) {
            axios.get('https://jsonplaceholder.typicode.com/photos?_limit=5').then(res => {
                commit('SET_BANNERS', res.data)
                console.log(res)
            })
        }
    },
    namespaced: true, // 命名空间
}
